package a.f.l.a;

import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;

class g
{
  private a_[] a;
  private int b;
  private int c;
  private Comparator d;
  
  public g(int paramInt, Comparator paramComparator)
  {
    this.a = new a_[paramInt + 2];
    this.b = 0;
    this.c = paramInt;
    this.d = paramComparator;
  }
  
  public List a()
  {
    boolean bool = sb.e;
    int j = sb.d;
    ArrayList localArrayList = new ArrayList();
    do
    {
      for (int i = 0; j == 0; i++)
      {
        if (i >= this.b) {
          break;
        }
        if (j != 0) {
          break label58;
        }
        localArrayList.add(this.a[i].a);
      }
    } while (bool);
    label58:
    return localArrayList;
  }
  
  public a_ a(Object paramObject1, Object paramObject2)
  {
    if (!sb.e) {
      if (this.b == this.c)
      {
        this.c += 1024;
        localObject = new a_[this.c + 2];
        System.arraycopy(this.a, 0, localObject, 0, this.a.length);
        this.a = ((a_[])localObject);
      }
    }
    this.b += 1;
    Object localObject = new a_(paramObject1, paramObject2, this.b);
    a(this.b, (a_)localObject);
    return localObject;
  }
  
  public void b()
  {
    boolean bool = sb.e;
    int j = sb.d;
    int i = this.a.length - 1;
    if (i >= 0) {}
    while (bool)
    {
      this.a[i] = null;
      i--;
      if ((!bool) && (j != 0)) {
        return;
      }
      if (j == 0) {
        break;
      }
    }
    this.b = 0;
  }
  
  void a(int paramInt, a_ parama_)
  {
    boolean bool = sb.e;
    int j = sb.d;
    this.a[0] = parama_;
    int i = paramInt / 2;
    a_ locala_ = this.a[i];
    if (this.d.compare(locala_.b, parama_.b) > 0) {
      this.a[paramInt] = locala_;
    }
    do
    {
      locala_.c = paramInt;
      paramInt = i;
      i >>= 1;
      locala_ = this.a[i];
      if ((!bool) && (j != 0)) {
        return;
      }
      if (j == 0) {
        break;
      }
      this.a[paramInt] = parama_;
    } while (bool);
    parama_.c = paramInt;
  }
  
  void b(int paramInt, a_ parama_)
  {
    boolean bool = sb.e;
    int j = sb.d;
    int i = paramInt << 1;
    this.a[(this.b + 1)] = this.a[this.b];
    if (i <= this.b) {}
    label135:
    do
    {
      a_ locala_ = this.a[i];
      if ((!bool) && (j != 0)) {
        return;
      }
      if (!bool) {
        if (i < this.b)
        {
          if (bool) {
            break label135;
          }
          if (this.d.compare(this.a[(i + 1)].b, locala_.b) < 0) {
            locala_ = this.a[(++i)];
          }
        }
      }
      if (!bool)
      {
        if (this.d.compare(parama_.b, locala_.b) > 0)
        {
          this.a[paramInt] = locala_;
          locala_.c = paramInt;
          paramInt = i;
          i <<= 1;
        }
      }
      else {
        if (j == 0) {
          break;
        }
      }
      this.a[paramInt] = parama_;
    } while (bool);
    parama_.c = paramInt;
  }
  
  public void a(a_ parama_)
  {
    boolean bool = sb.e;
    a_ locala_ = this.a[this.b];
    this.a[this.b] = null;
    if (!bool)
    {
      this.b -= 1;
      if (parama_ == locala_) {}
    }
    else
    {
      if (!bool) {
        if (this.d.compare(locala_.b, parama_.b) > 0)
        {
          if (bool) {
            break label92;
          }
          b(parama_.c, locala_);
          if (sb.d == 0) {
            return;
          }
        }
      }
      label92:
      a(parama_.c, locala_);
    }
  }
  
  public void a(a_ parama_, Object paramObject)
  {
    parama_.b = paramObject;
    a(parama_.c, parama_);
  }
  
  public void b(a_ parama_, Object paramObject)
  {
    boolean bool = sb.e;
    if (!bool) {
      if (this.d.compare(paramObject, parama_.b) < 0)
      {
        if (bool) {
          break label44;
        }
        a(parama_, paramObject);
        if (sb.d == 0) {
          return;
        }
      }
    }
    label44:
    c(parama_, paramObject);
  }
  
  public void c(a_ parama_, Object paramObject)
  {
    parama_.b = paramObject;
    b(parama_.c, parama_);
  }
  
  public a_ c()
  {
    return this.a[1];
  }
  
  public boolean d()
  {
    if (!sb.e) {}
    return this.b == 0;
  }
  
  public int e()
  {
    return this.b;
  }
  
  public static class a_
  {
    Object a;
    Object b;
    int c;
    public static boolean d;
    
    a_(Object paramObject1, Object paramObject2, int paramInt)
    {
      this.b = paramObject1;
      this.a = paramObject2;
      this.c = paramInt;
    }
    
    public Object a()
    {
      return this.a;
    }
    
    public Object b()
    {
      return this.b;
    }
  }
}


/* Location:           E:\idea\
 * Qualified Name:     a.f.l.a.g
 * JD-Core Version:    0.7.0.1
 */